/**
 * Created by mengweiqiang on 2017/4/28.
 */

function CheckPersonalInfo() {

    var UserName = $("#UserName").val();
    var Name = $("#Name").val();
    var TelPhone = $("#TelPhone").val();
    var Gender = $("input[name='Gender']:checked").val();
    var DateOfBirth = $("#DateOfBirth").val();
    var Email = $("#Email").val();
    var Company = $("#Company").val();
    var UserNameReg= /^[\u4e00-\u9fa5_a-zA-Z0-9]+$/;
    var TelPhoneReg =/^1[34578]\d{9}$/;
    var EmailReg =  /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;

    console.log(UserName);
    console.log(TelPhone);
    console.log(Name);
    console.log(Email);
    if( UserName.length!=0&&Name.length!=0&&TelPhone.length!=0 &&Email.length!=0&&Company.length!=0&&Gender.length!=0&&DateOfBirth!=0)
    {

        if(!UserNameReg.test(UserName))
        {
            alert("只允许属于中文、英文、数字！");
            return false;
        }
        console.log(TelPhone);
        if (!TelPhoneReg.test(TelPhone))
        {
            alert("移动电话填写不正确，请重新输入");
            return false;
        }

        console.log(Email);
        if(!EmailReg.test(Email))
        {
            alert("电子邮箱填写不正确，请重新输入");
            return false;
        }

        return true;

    }
    else
    {
        alert("必填项有空值，请检查!");
        return false;
    }
}
